<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateDirectoryTemplateTable extends AbstractMigration
{
    public function up()
    {
        $this->table('directory_template', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '目录模板表'])
            ->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '主键ID'])
            ->addColumn('name', 'string', ['default' => '', 'limit' => 128, 'comment' => '模板名字'])
            ->addColumn('created', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建时间'])
            ->addColumn('template_content', 'json', ['null' => true, 'comment' => '目录模板内容'])
            ->save();
    }

    public function down()
    {
        $this->table('directory_template')->drop()->save();
    }
}
